package com.zzyl.controller;

import com.zzyl.base.ResponseResult;
import com.zzyl.dto.NursingLevelDto;
import com.zzyl.service.NursingLevelService;
import com.zzyl.vo.NursingLevelVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

/**
 * @Description 护理等级
 * @Author mengkaishi
 * @Date 2024-07-08
 */
@RestController
@Api(tags = "护理项目等级")
@RequestMapping("/nursing_level")
public class NursingLevelController extends BaseController {
    @Autowired
    private NursingLevelService nursingGradeService;

    /**
     * 根据id查询护理项目等级
     *
     * @return
     */
    @GetMapping("/{id}")
    @ApiOperation("根据id查询")
    public ResponseResult<NursingLevelVo> getById(
        @ApiParam(value = "传入的id", required = true)
        @PathVariable Integer id) {
        NursingLevelVo nursingLevelVo = nursingGradeService.getById(id);
        return success(nursingLevelVo);

    }

    /**
     * 修改护理等级
     * @param nursingLevelDto
     * @return
     */
    @PutMapping
    @ApiOperation("修改护理等级")
    public  ResponseResult update(
            @ApiParam(value = "修改等级传入参数",required = true)
            @RequestBody NursingLevelDto nursingLevelDto){
            nursingGradeService.update(nursingLevelDto);
            return success();
    }

    /**
     * 根据id删除护理等级
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    @ApiOperation("根据ID删除护理等级")
    public ResponseResult delete(
            @ApiParam(value = "根据id删除护理等级",required = true)
            @PathVariable Integer id){
        nursingGradeService.delete(id);
        return success();
    }
}
